package cn.edu.hstc.wm.adapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * StoreItemActivity的Viewpager的适配器
 * 
 */
public class StoreItemAdapter extends FragmentPagerAdapter {
	/** 加入显示的Fragment */
	List<Fragment> fragments;
	/** 在tab上显示的标题 */
	String[] titles;

	public StoreItemAdapter(FragmentManager fm) {
		super(fm);
	}

	public StoreItemAdapter(FragmentManager fm, List<Fragment> list,
			String[] titles) {
		this(fm);
		this.fragments = list;
		this.titles = titles;
	}

	@Override
	public Fragment getItem(int arg0) {
		return fragments.get(arg0);
	}

	@Override
	public int getCount() {
		return fragments.size();
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return titles[position];
	}

}
